<?php
	require "settings/config.php";
	require "layout.php";
	require "includes/session.php";
	require "includes/sql_functions.php";
	require "includes/scen_functions.php";
	
	oh_require_admin();
	
	render_header("Administer Scenarios");
	
	if($_GET['updated']==1)
	{
		echo "Scenario updated.";
	}
	
	if($_GET['deleted']==1)
	{
		echo "Scenario deleted.";
	}
	
	if($_GET['delete'])
	{
		echo "<div style=\"display:inline-block;vertical-align:top;padding:0.5em\">";
		echo "<b>Confirm deletion of scenario ".$_GET['delete'].":</b>\n<br /><br />";
		make_button("Confirm","do_scenkill.php?delete=".$_GET['delete']);
		make_button("Cancel","scenarios.php");
		echo "</div>";	
	}
	
	echo "<div style=\"display:inline-block;vertical-align:top;padding:0.5em\">";
	
	
	echo "<b>Add a scenario:</b> ";
	
	if($_GET['missing']==1)
	{
		echo "A required field is missing!";
	}
	if($_GET['duplicate']==1)
	{
		echo "A scenario with this code already exists!";
	}
	if($_GET['success']==1)
	{
		echo "Scenario added.";
	}

	
?>
	<br /><br />

	<form action="do_scenadd.php" method="POST">
		Scenario Code: <input type="text" name="code" size="12" class="inputbox"> <br /> 
			<span class="smalltext">A unique code for this scenario, this is used internally and not displayed to players.</span> <br /><br /> 
			
		System: <input type="text" name="system" size="12" class="inputbox"><br /> 
			<span class="smalltext">The game's system, such as PFS, LFR, nWoD.</span><br /> <br /> 
				
		Title: <input type="text" name="title" size="64" class="inputbox"> <br /> 
			<span class="smalltext">The Scenario's title.</span> <br /><br /> 
		
		Subtitle: <input type="text" name="subtitle" size="64" class="inputbox"> <br /> 
			<span class="smalltext">The Scenario's subtitle, leave blank if it has no subtitle.</span> <br /><br /> 
		
		Minimum Level: <input type="text" name="minlevel" size="3" class="inputbox"> <br /> 
			<span class="smalltext">Minimum allowed player level.</span> <br /><br /> 
		
		Maximum Level: <input type="text" name="maxlevel" size="3" class="inputbox"> <br /> 
			<span class="smalltext">Maximum allowed player level.</span> <br /><br /> 
			
		Scenario Description: <br />
			<textarea name="desc" cols="50" rows="10" class="inputbox"></textarea></p>
		
		<input type="submit" class="button" value="Add Scenario">
	</form>
	</div>
	<div style="display:inline-block;vertical-align:top;padding:0.5em">
	<b>Current scenarios</b>:
<?php
	oh_render_scen_list();
?>
	</div>
<?php
	render_footer();
?>